Add a module entry to package.json#47
Merged
okonet merged 1 commit intoreact-dropzone:masterfrom Jul 30, 2020
edsrzf:es-module
Merged
Add a module entry to package.json#47okonet merged 1 commit intoreact-dropzone:masterfrom edsrzf:es-module
okonet merged 1 commit intoreact-dropzone:masterfrom
edsrzf:es-module
Conversation
okonet
approved these changes
Jul 30, 2020
|
🎉 This PR is included in version 2.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closed
Contributor
Author
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a
moduleentry topackage.json, pointing tosrc/index.js, which allows tools that use ES modules to avoid having to interoperate with the package's CommonJS build. This works around a problem that I've been experiencing includingreact-dropzonein a project that builds using Rollup.More Details of My Problem
I'm including
react-dropzonein a project that build using Rollup and have run into an issue with it importing this package (attr-accept).react-dropzoneships an ES module build, but this package does not, which causes@rollup/plugin-commonjsto run into some interop issues, and means that this line ends up trying to call an object, which throws an exception. (It's basically callingaccepts()when it needs to be callingaccepts.default().)Interop issues with
@rollup/plugin-commonjsare discussed in great detail here: rollup/plugins#481I've worked around the issue in my project through a horrible hack in my Rollup configuration to add a
moduleentry to this package'spackage.json. I would love to get a version of this package published that includes it already so I can get rid of my horrible hack. There are other benefits to exposing an ES module build anyway.